﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Core.Models
{
    /// <summary>
    /// 人员
    /// </summary>
    public class SysPerson:BaseModel
    {
        [StringLength(20)]
        public string Name { get; set; }

        [StringLength(20)]
        public string IdCard { get; set; }

        public int OrgId { get; set; }

        [StringLength(2)]
        public string Gender { get; set; }

        [StringLength(20)]
        public string Education { get; set; }

        [StringLength(30)]
        public string Position { get; set; }   // 职务

        [StringLength(50)]
        public string HomeAddress { get; set; }

        [StringLength(50)]
        public string Photo { get; set; }

        [StringLength(20)]
        public string LoginName { get; set; }
        [StringLength(50)]
        public string LoginPwd { get; set; }

        public int State { get; set; } // 状态 ：1-在职，0-离职，2-休假

        [ForeignKey(nameof(OrgId))]
        public virtual SysOrg Org { get; set; }

        public virtual ICollection<SysRole> Roles { get; set; }

        public SysPerson()
        {
            Roles = new List<SysRole>();
        }
    }
}
